package com.zero.manage.web.components.entity;

import com.zero.manage.web.components.base.BaseEntity;
import io.gitee.zerowsh.enums.ToolEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.util.UUID;

/**
 * 平台日志
 */
@Entity
@Table(name = "sys_log")
@Getter
@Setter
@ApiModel("系统日志")
public class SysLogEntity extends BaseEntity<String> {
    @Id
    @Column(name = "id")
    @ApiModelProperty("主键")
    protected String id = UUID.randomUUID().toString();

    @Column(name = "title")
    @ApiModelProperty("标题")
    protected String title;

    @Column(name = "operation")
    @ApiModelProperty("操作")
    protected String operation;

    @Column(name = "username")
    @ApiModelProperty("用户名")
    protected String username;

    @Column(name = "level")
    @ApiModelProperty("等级")
    @Enumerated(EnumType.STRING)
    protected ToolEnums.LogLevelEnums level;

    @Column(name = "method")
    @ApiModelProperty("请求方法")
    protected String method;

    @Column(name = "request_address")
    @ApiModelProperty("请求地址")
    protected String requestAddress;

    @Column(name = "createTime")
    @ApiModelProperty("创建时间")
    protected Long createTime;

    @Column(name = "data")
    @ApiModelProperty("内容信息")
    protected String data;

    @Override
    public String getKeyId() {
        return this.id;
    }
}
